Wikipedia:Bots/Requests for approval/Theo's Little Bot 10
- The following discussion is an archived debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA. The result of the discussion was Approved.
Operator: Theopolisme (talk · contribs · SUL · edit count · logs · page moves · block log · rights log · ANI search)
Time filed: 01:55, Friday April 26, 2013 (UTC)
Automatic, Supervised, or Manual: Automatic
Programming language(s): Python + mwclient + mwparserfromhell
Source code available: on github
Function overview: Automatically archives old nominations at WP:TAFI, either moving them to an archive page (if unsuccessful) or to the TAFI holding area (if successful).
Links to relevant discussions (where appropriate): Wikipedia_talk:Today's_articles_for_improvement#A_bot_to_automatically_handle_nominations.3F
Edit period(s): Daily
Estimated number of pages affected: 3 per month (TAFI noms page, TAFI monthly archive page, and TAFI holding area).
Exclusion compliant (Yes/No): No, unneeded
Already has a bot flag (Yes/No): Yes
Function details: For each nomination on Wikipedia:Today's articles for improvement/Nominated articles...
- If the nomination has a net support of 3 or more (wherein opposes count as -1), it is moved to the Wikipedia:Today's articles for improvement/Holding area.
- If the nomination has been inactive for 10 days and has less that 3 supports, the bot moves it to the current month's archive.
Discussion
[edit]- Seems like an appropriate bot task, and you have community support via a request, straight forward, experienced operator, good communication. -166.137.210.34 (talk) 18:24, 26 April 2013 (UTC)[reply]
- Accidentally did a test run with the bot account instead of my own to make sure replace() method was working alright—which it was. Sorry about that. —Theopolisme (talk) 19:42, 27 April 2013 (UTC)[reply]
- Approved for trial (50 edits or 5 days). Please provide a link to the relevant contributions and/or diffs when the trial is complete. ·Add§hore· Talk To Me! 09:47, 29 April 2013 (UTC)[reply]
- Day 1 of trial complete - to nominations page, to holding area, to archive —Theopolisme (talk) 11:11, 29 April 2013 (UTC)[reply]
- Trial complete. Edits can be viewed at [1] Theopolisme (talk) 11:11, 4 May 2013 (UTC)[reply]
- Would it be possible to stop the bot from leaving multiple new lines in a row? ·Add§hore· Talk To Me! 14:19, 2 May 2013 (UTC)[reply]
- @Addshore: Sorry, I don't think I quite understand what you're talking about--could you give an example? Thanks, Theopolisme (talk) 02:13, 5 May 2013 (UTC)[reply]
- This is the revision your bot made; notice that there is a blank line at the bottom of the Cantopop section. Before your bot edited there was not a blank line at the bottom of this section. -68.107.137.178 (talk) 09:08, 5 May 2013 (UTC)[reply]
- Thanks for pointing that out. Hmm, I'm currently using the following regular expression to make each nomination:
(\{\{TAFI nom[.\|].*?)(?=[^=]{{TAFI)
. @Legoktm: could you take a look, since you're the real wiz around here? Theopolisme (talk) 12:38, 5 May 2013 (UTC)[reply]- It should be as simple as changing it to something like
(\{\{TAFI nom[.\|].*?)\n?(?=[^=]{{TAFI)
I think! ·Add§hore· Talk To Me! 09:53, 7 May 2013 (UTC)[reply]- *headdesk* Thanks. Implemented on github. Theopolisme (talk) 11:12, 7 May 2013 (UTC)[reply]
- Approved for trial (a few more edits). Please provide a link to the relevant contributions and/or diffs when the trial is complete. ·Add§hore· Talk To Me! 12:06, 7 May 2013 (UTC)[reply]
- Well, that didn't work. I tried
(\n?\{\{TAFI nom[.\|].*?)[\n\r]*?(?=[^=]{{TAFI)
as well...which didn't work. Hmmm...are the newlines using some other character? Theopolisme (talk) 11:27, 8 May 2013 (UTC)[reply]- A hacky solution that *works* for now is just replacing
\(UTC\)\n\n*(?!#)
with(UTC)\n\n
. Theopolisme (talk) 11:20, 9 May 2013 (UTC)[reply]
- A hacky solution that *works* for now is just replacing
- Well, that didn't work. I tried
- It should be as simple as changing it to something like
- Thanks for pointing that out. Hmm, I'm currently using the following regular expression to make each nomination:
- This is the revision your bot made; notice that there is a blank line at the bottom of the Cantopop section. Before your bot edited there was not a blank line at the bottom of this section. -68.107.137.178 (talk) 09:08, 5 May 2013 (UTC)[reply]
- @Addshore: Sorry, I don't think I quite understand what you're talking about--could you give an example? Thanks, Theopolisme (talk) 02:13, 5 May 2013 (UTC)[reply]
BAGAssistanceNeeded Can I get approval on this (prompted via Wikipedia_talk:Today's_articles_for_improvement#Improvement_tracking_2)? Theopolisme (talk) 20:30, 14 May 2013 (UTC)[reply]
- (Non-administrator comment) The comment directly above this says that you are using a "hacky solution"... Has that been resolved correctly? I would think that a requirement of approval would be "no hacky solutions", but as I'm a no-body here, I could be wrong. FTR, I think this is a great idea and I support this bot, I just think it should be as hack/bug free as possible before approval. Technical 13 (talk) 14:20, 15 May 2013 (UTC)[reply]
- I agree that a non-hacky solution is called for. This is a long term, daily bot, can you try to fix this in a more robust way? -166.137.209.148 (talk) 17:44, 15 May 2013 (UTC)[reply]
- I currently don't have the regular expression skills to resolve this on my own. I asked Legoktm for help, but he didn't respond. Anyone is welcome to comment, of course:
(\{\{TAFI nom[.\|].*?)(?=[^=]{{TAFI)
is the regex I'm using currently, and I need it to match newlines above and below the text in question. Theopolisme (talk) 21:09, 15 May 2013 (UTC)[reply] - Firstly, shouldn't it be
(\{\{TAFI nom[.\|].*?)(?=[^=]\{\{TAFI)
and then, couldn't you go a little further and mark the start with^
like^(\{\{TAFI nom[.\|].*?)(?=[^=]\{\{TAFI)
In order for me to refine it further (I think it will need it) I need to figure out exactly what you are trying to find and what you are replacing it with... Unfortunately, I don't have quite that much time right this minute. Technical 13 (talk) 21:36, 15 May 2013 (UTC)[reply] - So you want to match the template, and any comment lines below? Stopping just before the next template? ·Add§hore· Talk To Me! 10:40, 18 May 2013 (UTC)[reply]
- The regex I have now matches the template and all comment lines below, stopping just before the next template, yes. But I now also want to match any and all whitespace before the template...and
\n*
didn't work. Maybe\s
? Theopolisme (talk) 13:52, 18 May 2013 (UTC)[reply]\s
is the same as[ \t\r\n\v\f]
which would actually catch those instances of there being just a space or a tab on a line that we can't see but throws the match off. Technical 13 (talk) 18:12, 18 May 2013 (UTC)[reply]
- @Technical 13 and Legoktm: Tried
\s
; didn't work. Here's the current code. Theopolisme (talk) 13:48, 19 May 2013 (UTC)[reply]'(\s*\{\{TAFI nom[.\|].*?)[\r\n]*?(?=[^=]{{TAFI)'
→'(\s*?\{\{TAFI nom[.\|].*?)\s*?(?=[^=]\{\{TAFI)'
Is it being greedy at the start and are there unusual spaces in the middle? Also, shouldn't the{
near the end be escaped? Technical 13 (talk) 14:31, 19 May 2013 (UTC)[reply]- In the source code I linked, I was already using exactly what you just suggested. And yes, it was (already) escaped. Cheers, and thanks for your help, Theopolisme (talk) 20:53, 20 May 2013 (UTC)[reply]
- Comment: Are we good to go for approval? MBisanz talk 03:11, 21 May 2013 (UTC)[reply]
- Good for me if the bot operator thinks the spacing issue is covered, maybe run through initial edits himself and confirm, but it seems good to me. -166.137.209.152 (talk) 12:53, 22 May 2013 (UTC)[reply]
- All good here; ready for approval. Theopolisme (talk) 21:49, 23 May 2013 (UTC)[reply]
- Approved. ·Add§hore· Talk To Me! 21:50, 23 May 2013 (UTC)[reply]
- The above discussion is preserved as an archive of the debate. Please do not modify it. To request review of this BRFA, please start a new section at WT:BRFA.